import docx

from docx.shared import Inches
from PIL import Image
import os

# create a new Word document
#document = docx.Document()

# set the path to the "未命名文件夹" folder under the "下载" directory
folder_path = os.path.expanduser("/Users/zhangxiangbin/Desktop/BYD/")

# loop through all the files in the folder
for filename in os.listdir(folder_path):
    print(filename)
    # check if the file is an image
    if filename.endswith(".jpg") or filename.endswith(".HEIC"):
        # add the image to the Word document
        print(filename)
        img_path = os.path.join(folder_path, filename)
        document.add_picture(img_path, width=Inches(6))

# save the Word document
#document.save("output.docx")
